<?php
class Q_Filter_Trim extends Q_Filter_Abstract {

    /**
     * The parameters that were passed to this filter
     */
    protected $_params = array(
        'charlist' => null,
    );
    public function doFilter($value) {
    
        if (is_array($value)) {
            $ret = array();
            if ($this->getParam('charlist')) {
                foreach ($value as $val) {
                    $ret[] = trim($val, $this->getParam('charlist'));
                }
            } else {
                foreach ($value as $val) {
                    $ret[] = trim($val);
                }
            }
            return $ret;
        }
        return (!$this->getParam('charlist')) ? trim($value) : trim($value, $this->getParam('charlist'));
    
    }

}
